<include file="Common:header" title="服务列表"/>
<link href="__PUBLIC__/assets/css/plugins/blueimp/css/blueimp-gallery.min.css" rel="stylesheet">
<link href="__PUBLIC__/assets/css/plugins/footable/footable.core.css" rel="stylesheet">
<style>
    .title{overflow: hidden;text-overflow: ellipsis;display: -webkit-box;-webkit-line-clamp: 1;-webkit-box-orient: vertical;}
    .mytable {
        table-layout: fixed;
        width: 100%;
    }
</style>
<div id="wrapper">
    <div class="wrapper wrapper-content">
        <div class="row">
            <div class="col-sm-12">
                <div class="ibox float-e-margins">
                    <div class="ibox-title"><h5>服务列表</h5></div>
                    <div class="ibox-content">
                        <div class="row">
                            <div class="col-lg-12">
                                <div class="col-xs-12 col-sm-5">
                                    <form name="admin_list_sea" class="form-search" method="post" action="{:U('Service/index')}">
                                        <div class="input-group">
                                            <input type="text" name="val" id="val" class="form-control search-query admin_sea" value="{$val}" placeholder="输入需查询的服务名称" />
                                            <span class="input-group-btn">
											<button type="submit" class="btn btn-purple">
												<span class="ace-icon fa fa-search icon-on-right bigger-110"></span>
												搜索
											</button>
										</span>
                                        </div>
                                    </form>
                                </div>
                                <div class="input-group-btn">
                                    <a href="{:U('Service/index')}">
                                        <button type="button"  class="btn  btn-info">
                                            <span class="ace-icon fa fa-globe icon-on-right bigger-110"></span>
                                            显示全部
                                        </button>
                                    </a>
                                </div>
                            </div>
                        </div>
                        <div class="table-responsive"><br/>

                            <table width="100%" class="table table-bordered table-hover mytable">
                                <thead>
                                <tr>
                                    <th width="5%">ID</th>
                                    <th width="15%">服务名称</th>
                                    <th width="15%">服务内容</th>
                                    <th width="25%">服务简介</th>
                                    <th width="8%">图片</th>
                                    <th width="17%">添加时间</th>
                                    <th width="5%">是否置顶</th>
                                    <th width="10%">操作</th>

                                </tr>
                                </thead>

                                <tbody>
                                <foreach name="data" item="v">
                                    <tr>
                                        <td height="28" >{$v.id}</td>
                                        <td><div class="title" style="cursor:pointer" onclick="detailed(this)">{$v.service_name}</div></td>
                                        <td>{:get_service_type_name($v['service_type'])}</td>
                                          <td><div class="title" style="" onclick="detailed(this)">{$v.service_summary}</div></td>

                                        <?php $image = explode(',',$v['images']); ?>



                                        <td>
                                        <a href="{$image[0]}" title="点击查看大图" data-gallery=""><img style="width:70px;height: 70px;margin-right: 5px;" src='{$image[0]}' /></a>
                                        </td>
                                        <td>
                                        {$v.add_time|date='Y-m-d H:i:s',###}
                                        </td>
                                        <td>
                                        <if condition="$v[top] eq 1">
                                        <button style="margin:0;" type="button" class="btn btn-xs btn-primary" onclick="change({$v.id},this);">置顶</button>
                                        <else/>
                                        <button style="margin:0;" type="button" class="btn btn-xs btn-danger" onclick="change({$v.id},this);">不置顶</button>
                                        </if>
                                        </td>


                                        <td>
                                        <a style="margin:0;" class="btn btn-xs btn-info"  href="{:U('Service/edit_service',array('id'=>$v['id']))}">
                                        <i class="fa fa-pencil" style="font-size: 14px;"></i>&nbsp;编辑</a>
                                        <a class="red" href="javascript:;" onclick="del({$v.id})"  title="删除">
                                        <span class="label label-danger">删除</span>
                                        </a>
                                        </td>

                                        </tr>
                                    </tr>
                                </foreach>
                                <tr>
                                    <td height="50" colspan="11" align="right">{$page}</td>
                                </tr>
                                </tbody>

                            </table>

                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<div id="blueimp-gallery" class="blueimp-gallery">
    <div class="slides"></div>
    <h3 class="title"></h3>
    <a class="prev">‹</a>
    <a class="next">›</a>
    <a class="close">×</a>
    <a class="play-pause"></a>
    <ol class="indicator"></ol>
</div>
<include file="Common:footer"/>
<script src="__PUBLIC__/assets/js/plugins/blueimp/jquery.blueimp-gallery.min.js"></script>
<script src="__PUBLIC__/assets/js/plugins/footable/footable.all.min.js"></script>
<script>

    function del(id) {
        layer.confirm('你确定要删除？', {
            btn: ['确定','取消'] //按钮
        }, function(){
            window.location.href="__URL__/del_service/id/"+id;
        });
    }

    function change(id,btn) {
        $.post("{:U('Service/top_status')}",{id:id},function (data) {
            $(btn).text(data.info);
            if(data.info=='置顶'){
                $(btn).removeClass('btn-danger');
                $(btn).addClass('btn-primary');
            }else{
                $(btn).removeClass('btn-primary');
                $(btn).addClass('btn-danger');
            }
        });
    }
    function detailed(obj) {
        if(obj.getAttribute('class')=='title'){
            var reg = new RegExp('(\\s|^)title(\\s|$)');
            obj.className = obj.className.replace(reg, ' ');
        }
        else{
            obj.className = "title";
        }
    }
</script>
